package com.itheima.mapper;

import com.itheima.entity.Emp;
import com.itheima.entity.PageQueryObject;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;

import java.util.List;

@Mapper
public interface EmpMapper {
    List<Emp> serch(PageQueryObject pageQueryObject);

    @Insert("INSERT INTO emp(username, password, name, gender, phone, job, salary, image, entry_date, dept_id, create_time, update_time) " +
            "VALUES (#{username}, #{password}, #{name}, #{gender}, #{phone}, #{job}, #{salary}, #{image}, #{entryDate}, #{deptId}, #{createTime}, #{updateTime})")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    void save(Emp emp);


    Emp selectById(Integer id);

//    @Options(useGeneratedKeys = true, keyProperty = "id")这里不需要主键返回，emp里面传了id
    void update(Emp emp);

    void delete(List<Integer> ids);

    List<Emp> list();
}
